var a = require("../../../@babel/runtime/helpers/toConsumableArray"), t = getApp();

Page({
    data: {
        listData: [],
        isLoadMore: !0,
        total_page: 0,
        page: 1
    },
    onLoad: function(a) {
        this.getRecordList();
    },
    onReady: function() {},
    onShow: function() {},
    onHide: function() {},
    onUnload: function() {},
    onPullDownRefresh: function() {},
    onReachBottom: function() {
        this.data.isLoadMore ? this._getMoreData() : console.log("没有更多数据");
    },
    onShareAppMessage: function() {},
    _getMoreData: function() {
        var e = this, o = this;
        if (!(this.data.page >= this.data.total_page)) {
            var s = t.getNetAddresss("plugin.health-assessment.api.index.getData");
            this.data.page++, t._postNetWork({
                url: s,
                data: {
                    art: "getRecord",
                    page: this.data.page
                },
                success: function(t) {
                    var s = t.data;
                    if (1 == s.result) {
                        s.data.getRecord.current_page >= s.data.getRecord.last_page && o.setData({
                            isLoadMore: !1
                        });
                        var i = e.data.listData;
                        i.push.apply(i, a(s.data.getRecord.data)), e.setData({
                            listData: i
                        });
                    }
                },
                fail: function(a) {
                    console.log(a.msg);
                }
            });
        }
    },
    getRecordList: function() {
        var a = this, e = this, o = t.getNetAddresss("plugin.health-assessment.api.index.getData");
        t._postNetWork({
            url: o,
            data: {
                art: "getRecord"
            },
            success: function(t) {
                var o = t.data;
                1 == o.result && (a.data.total_page = o.data.getRecord.last_page, o.data.getRecord.current_page >= o.data.getRecord.last_page && e.setData({
                    isLoadMore: !1
                }), a.setData({
                    listData: o.data.getRecord.data
                }));
            },
            fail: function(a) {
                console.log(a.msg);
            }
        });
    },
    gotoDetails: function(a) {
        var t = a.currentTarget.dataset.item;
        wx.navigateTo({
            url: "/packageE/healthy/healthyDetails/healthyDetails?record_id=" + t.id
        });
    }
});